package cate.game.play.buff.h;

import cate.game.attr.FightAttr;
import cate.game.play.buff.BuffHandler;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.proce.action.ctx.ActionCtx;
import easy.java.dev.note.NoteClass;

@NoteClass("属性偷取")
public class 属性偷取BH extends BuffHandler {

	private FightAttr 属性;

	private int 结束反馈buff;

	//属性=？？&结束反馈buff=??
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		属性 = new FightAttr(args.get("属性"));
		结束反馈buff = args.getInt("结束反馈buff", 0);
	}

	@Override
	public void parseExt(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		属性.add(new FightAttr(args.get("属性")));
	}

	@Override
	public void onAdd(ActionCtx action) {
		buff.caster.attr.addAttr(属性, true, action);
		buff.owner.attr.addAttr(属性, false, action);
	}

	@Override
	public void onInvalid(ActionCtx action, byte invalidReason) {
		buff.caster.attr.addAttr(属性, false, action);
		buff.owner.attr.addAttr(属性, true, action);
		if (结束反馈buff > 0) {
			buff.caster.buff.tryAddByTid(action, 结束反馈buff);
		}
	}
}
